﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using com.ClickCricket.bll;


/// <summary>
/// Summary description for SlideService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
[System.Web.Script.Services.ScriptService]
public class SlideService : System.Web.Services.WebService {

    public SlideService () {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod]
    public AjaxControlToolkit.Slide[] GetSlides1()
    {
        List<Country> _countryList = CountryService.Instance.getCountries();

        AjaxControlToolkit.Slide[] slides = new AjaxControlToolkit.Slide[_countryList.Count];
        int count = 0;
        for (int i = _countryList.Count - 1; i >= 0; i--)
        {
            Country c = (Country)_countryList[i];
            string image = c.CountryImage.Substring(2, c.CountryImage.Length - 2);
            string link = "<A HREF=\"Country.aspx?CountryId=" + c.CountryId + "\">" + c.CountryName + "</A>";
            slides[count] = new AjaxControlToolkit.Slide(image, c.CountryName, link);
            count++;
        }
        return (slides);
    }

    [WebMethod]
    public AjaxControlToolkit.Slide[] GetSlides2()
    {
        List<Country> _countryList = CountryService.Instance.getCountries();

        _countryList.Add(_countryList[0]);
        _countryList.RemoveAt(0);

        AjaxControlToolkit.Slide[] slides = new AjaxControlToolkit.Slide[_countryList.Count];
        int count = 0;
        for (int i = _countryList.Count - 1; i >= 0; i--)
        {
            Country c = (Country)_countryList[i];
            string image = c.CountryImage.Substring(2, c.CountryImage.Length - 2);
            string link = "<A HREF=\"Country.aspx?CountryId=" + c.CountryId + "\">" + c.CountryName + "</A>";
            slides[count] = new AjaxControlToolkit.Slide(image, c.CountryName, link);
            count++;
        }
        return (slides);
    }

    [WebMethod]
    public AjaxControlToolkit.Slide[] GetSlides3()
    {
        List<Country> _countryList = CountryService.Instance.getCountries();

        _countryList.Add(_countryList[0]);
        _countryList.RemoveAt(0);

        _countryList.Add(_countryList[0]);
        _countryList.RemoveAt(0);

        int count = 0;
        AjaxControlToolkit.Slide[] slides = new AjaxControlToolkit.Slide[_countryList.Count];
        for (int i = _countryList.Count - 1; i >= 0; i--)
        {
            Country c = (Country)_countryList[i];
            string image = c.CountryImage.Substring(2, c.CountryImage.Length - 2);
            string link = "<A HREF=\"Country.aspx?CountryId=" + c.CountryId + "\">" + c.CountryName + "</A>";
            slides[count] = new AjaxControlToolkit.Slide(image, c.CountryName, link);
            count++;
        }
        return (slides);
    }
}

